function Ankhy_Priest_2()
	ccRS.Auto_Target = false
	ccRS.Auto_Facing = false
	-- Target Player to heal
	local vTargetPlayerToHeal = true
	if ccrTargetName() == "Thok the Bloodthirsty" then vTargetPlayerToHeal = false else vTargetPlayerToHeal = true end
	------------------------
	-- Cascade
	local vTalent = {GetTalentInfo(16)}
	local vGotCascade = false
	if vTalent[6] == true then vGotCascade = true else vGotCascade = false end
	----------------
	-- Divine Star
	local vTalent = {GetTalentInfo(17)}
	local vGotDivineStar = false
	if vTalent[6] == true then vGotDivineStar = true else vGotDivineStar = false end
	----------------
	-- Halo
	local vTalent = {GetTalentInfo(18)}
	local vGotHalo = false
	if vTalent[6] == true then vGotHalo = true else vGotHalo = false end
	----------------------
	-- Mindbender
	local vTalent = {GetTalentInfo(8)}
	local vGotMindbender = false
	if vTalent[6] == true then vGotMindbender = true else vGotMindbender = false end
	----------------------
	-- Cast Power Word: Fortitude
	ccrCastBuffIfMissing("Power Word: Fortitude")
	 ---------------------
	 -- Cast Inner Fire
	ccrCastBuffIfMissing("Inner Fire")
	 ---------------------
	 -- NPC healing Immerseus and Norushen
	if ccrPlayerIsInCombat() then
		if tblTGetNearbyNPC ~= nil
		and #tblTGetNearbyNPC > 0 
		then
			for x = 1, #tblTGetNearbyNPC do
				local vNPC = tblTGetNearbyNPC[x]
				if vNPC
				and vNPC:Exists()
				and not vNPC:IsDead()
				and (
					vNPC:GetName() == "Contaminated Puddle"
					)
				then
					local vNPC_Health = (vNPC:GetHealth()/vNPC:GetMaxHealth()*100)
					if vNPC:GetAura("Lingering Corruption") ~= nil then
						vNPC:Target()
						vNPC:CastSpellByName("Purify")
					end
					if vNPC_Health < 100 then
						vNPC:Target()
						vNPC:CastSpellByName("Greater Heal")
						return
					end
				end
			end
		end
		if tblTGetNearbyNPC ~= nil
		and #tblTGetNearbyNPC > 0 
		then
			for x = 1, #tblTGetNearbyNPC do
				local vNPC = tblTGetNearbyNPC[x]
				if vNPC
				and vNPC:Exists()
				and not vNPC:IsDead()
				and (
					vNPC:GetName() == "Leven Dawnblade"
					or vNPC:GetName() == "Rook Stonetoe"
					or vNPC:GetName() == "Sun Tenderheart"
					)
				then
					local vNPC_Health = (vNPC:GetHealth()/vNPC:GetMaxHealth()*100)
					if vNPC:GetAura("Lingering Corruption") ~= nil then
						vNPC:Target()
						vNPC:CastSpellByName("Purify")
					end
						if vNPC_Health < 99 then
						vNPC:Target()
						vNPC:CastSpellByName("Prayer of Healing")
						return
					end
				end
			end
		end
	end
	local vToDispel = ccrFindDebuffInGroup("Mark of Arrogance")
	if vToDispel
		and SpellIsReady("Purify")
		and ccrPlayerHasDebuff("Gift of the Titans")
	then
		ccrCast("Purify", vToDispel)
		vToDispel = nil
		return
	end	
	if vToDispel
		and ccrTargetName() == "Sha of Pride"
		and ccrTargetHealth() <= 30
	then
		ccrCast("Purify", vToDispel)
		vToDispel = nil
		return
	end	
	--------------------------
	-- Find all nearby players
	Gather_Nearby_Players()
	--------------------------
	-- Autoaccept LFR invite
	AcceptProposal();
	--------------------------
	-- Autoaccept Readycheck
	ConfirmReadyCheck(1)
	--------------------------
	-- Autoaccept Resurrection
	AcceptResurrect()
	--------------------------
	-- Find who has the lowest health
	local vPlayerToHeal, vPlayerHealth = Find_Lowest_HP()
	if vPlayerToHeal ~= nil
	and vPlayerHealth ~= nil
	then
		-- Raid Specific
		if ccrUnitHasDebuff(vPlayerToHeal, "Strong Ancient Barrier", "any") then vPlayerHealth = 60 end
		if ccrUnitHasDebuff(vPlayerToHeal, "Ancient Barrier", "any") then vPlayerHealth = 40 end
		if ccrUnitHasDebuff(vPlayerToHeal, "Weak Ancient Barrier", "any") then vPlayerHealth = 30 end

		if IsShiftKeyDown() then 
				ccrCast("Holy Word: Chastise")
				CameraOrSelectOrMoveStart()
				CameraOrSelectOrMoveStop()
			return
		end
		 
		-- Wait until casting is over 
		if ccrPlayerIsCastingOrChanneling() then return end
		--
		
		-- Dispel
		if SpellIsReady("Purify") then
			if ccrUnitHasDebuffStacks(vPlayerToHeal, "Shadow Word: Bane", 2, "any")
			or ccrUnitHasDebuff(vPlayerToHeal, "Self-Absorbed")
			or ccrUnitHasDebuffStacks(vPlayerToHeal, "Corrosive Blood", 1, "any")
			then
				ccrCast("Purify", vPlayerToHeal)
			end
		end
		local vPlayerWithDebuff = ccrFindDebuffInGroup("Mark of Arrogance")
		if vPlayerWithDebuff ~= nil
			and ccrPlayerHasDebuff("Gift of the Titans")
			and ccrSpellIsReady("Purify")
			then
				ccrCast("Purify", vPlayerWithDebuff)
		return
		end
		if vPlayerWithDebuff ~= nil
			and ccrTargetName() == "Sha of Pride"
			and ccrTargetHealth() <= 30
			and ccrSpellIsReady("Purify")
			then
				ccrCast("Purify", vPlayerWithDebuff)
		return
		end
		local vPlayerWithDebuffBane = ccrFindDebuffInGroup("Shadow Word: Bane")
		if vPlayerWithDebuffBane ~= nil
		and ccrPlayerHasBuff("Lucidity")
		and ccrSpellIsReady("Mass Dispel")
		then
			ccrCast("Mass Dispel")
			if SpellIsTargeting() == 1 then CastAtLocation(Player:GetLocation()) end
			return
		end
		local vPlayerWithDebuffBlood = ccrFindDebuffInGroup("Corrosive Blood")
		if vPlayerWithDebuffBlood ~= nil
		and ccrPlayerHasBuff("Lucidity")
		and ccrSpellIsReady("Mass Dispel")
		then
			ccrCast("Mass Dispel")
			if SpellIsTargeting() == 1 then CastAtLocation(Player:GetLocation()) end
			return
		end
	    --------------------------------- Heroic SOO
		-- Heroic Dark Shamans
		--------------------------------- Mana \ Survival \ CD
		-- Mindbender
		if vGotMindbender then
		    if ccrPlayerMana() <= 90
		    and SpellIsReady("Shadowfiend")
		    then
		        ccrCast("Shadowfiend")
		    end	
		else
		    -- Shadowfiend
			if ccrPlayerMana() <= 80
		    and SpellIsReady("Shadowfiend")
		    then
		        ccrCast("Shadowfiend")
		    end	
		end
		
		-- Desperate Prayer
		if ccrPlayerHealth() <= 30
		and SpellIsReady("Desperate Prayer")
		then
			ccrCast("Desperate Prayer") 
		end	
		
        -- Angelic Feather
		if IsMounted() == nil
		and SpellIsReady("Angelic Feather")
		and not ccrPlayerHasBuff("Angelic Feather")
		and ccrPlayerIsMoving()
		then
			ccrCast("Angelic Feather")
			if SpellIsTargeting() == 1 then CastAtLocation(Player:GetLocation()) end
			return
		end
		
		--------------------------------- Emergency Heal
		-- Void Shift
		if vPlayerHealth <= 20
		and ccrPlayerHealth() >= 70
		then if ccrPlayerIsCastingOrChanneling then SpellStopCasting() end
		    ccrCast("Void Shift", vPlayerToHeal)
			return
		end
		
		if vPlayerHealth <= 30
		and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
		then if ccrPlayerIsCastingOrChanneling then SpellStopCasting() end
		    ccrCast("Guardian Spirit", vPlayerToHeal)
			return
		end
		
		-- Binding Heal on tank at 40% and player 80%
		if vPlayerHealth <= 40
		and ccrPlayerHealth() <= 80 and ccrPlayerHealth() >= 41
		and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
		and not ccrPlayerIsMoving()
		then
		    ccrCast("Binding Heal", vPlayerToHeal)
			return
		end
		
		-- Flash heal on tank at 35%
		if vPlayerHealth <= 40
		and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
		and not ccrPlayerIsMoving()
		then
		    ccrCast("Flash Heal", vPlayerToHeal)
			return
		end
		-- Binding Heal
		if vPlayerHealth <= 31
		and ccrPlayerHealth() <= 60 and ccrPlayerHealth() >= 31
		and not ccrPlayerIsMoving()
		then
		    ccrCast("Binding Heal", vPlayerToHeal)
			return
		end

		
		--------------------------------- LMG procs
		-- Binding heal with LMG proc
		if ccrPlayerHasBuff("Lucidity")
			and ccrPlayerHasBuffRemaining("Lucidity", 1.5)
			and vPlayerHealth <= 90
			and ccrPlayerHealth() <= 100 
			and ccrPlayerHealth() >= 91
			and not ccrPlayerIsMoving()
			then
		    ccrCast("Binding Heal", vPlayerToHeal)
			return
		end
		  -- Cascade with LMG proc
		if vGotCascade then
		    if ccrPlayerHasBuff("Lucidity")
		    and SpellIsReady("Cascade")
		    then
		       ccrCast("Cascade", vPlayerToHeal)
			   return
			end
		end				
	    -- Divine Star with LMG proc
		if vGotDivineStar then
            if ccrPlayerHasBuff("Lucidity")
            and SpellIsReady("Divine Star")
            then
                ccrCast("Divine Star")
				return
            end
		end
		-- Halo with LMG proc
		if vGotHalo then
            if ccrPlayerHasBuff("Lucidity")
            and SpellIsReady("Halo")
            then
                ccrCast("Halo")
				return
            end
        end
		-- Divine Star at 4 x 87%
	    if GroupedPlayersHealth(vPlayerToHeal, 20, 87) >= 4 then
	    if SpellIsReady("Divine Star")
	    then
			ccrCast("Divine Star")
			return
			end
	    end	
		-- Cascade at 5 x 85%
		if GroupedPlayersHealth(vPlayerToHeal, 20, 85) >= 8 then
		if SpellIsReady("Cascade")
		then
			ccrCast("Cascade", vPlayerToHeal)
			return
		    end
        end 
		-- Halo
		if GroupedPlayersHealth(vPlayerToHeal, 20, 70) >= 8 then
		if SpellIsReady("Halo")
		then
			ccrCast("Halo")
			return
			end
	    end	
		-- Prayer of Mending on tank when LMG proc
		if vPlayerHealth <= 100
		and ccrPlayerHasBuff("Lucidity")
		and SpellIsReady("Prayer of Mending")
		and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
		then
		    ccrCast("Prayer of Mending", vPlayerToHeal)
			return
		end	
		
        --------------------------------- Chakra: Sanctuary
		if ccrPlayerHasBuff("Chakra: Sanctuary") then
			-- Prayer of Mending
			if GroupedPlayersHealth(vPlayerToHeal, 20, 95) >= 3
				and ccrPlayerHasBuff("Divine Insight")
				and SpellIsReady("Prayer of Mending")
					then
						ccrCast("Prayer of Mending", vPlayerToHeal)
					return
			end
			-- Flash Heal with Serendipity
			if vPlayerHealth <= 90
					and ccrPlayerHasBuff("Surge of Light")
						then
							ccrCast("Flash Heal", vPlayerToHeal)
						return
			end
			-- Circle of Healing
			if SpellIsReady("Circle of Healing")
				then
					ccrCast("Circle of Healing", vPlayerToHeal)
				return
			end
			-- Prayer of Mending
			if vPlayerHealth <= 99
				and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
				and SpellIsReady("Prayer of Mending")
					then
						ccrCast("Prayer of Mending", vPlayerToHeal)
					return
			end
			-- Prayer of Healing
			if vPlayerHealth <= 90
				and not ccrPlayerIsMoving()
				and GroupedPlayersHealth(vPlayerToHeal, 20, 90) >= 3
				then
					ccrCast("Prayer of Healing", vPlayerToHeal)
				return
			end
			-- Serendipity 
			if ccrPlayerHasBuff("Serendipity") then
				if not ccrPlayerIsMoving() 
					and GroupedPlayersHealth(vPlayerToHeal, 20, 90) >= 4
						then
							ccrCast("Prayer of Healing", vPlayerToHeal)
						return
				
				else
					if not ccrPlayerIsMoving() 
						and GroupedPlayersHealth(vPlayerToHeal, 20, 80) >= 3
							then
								ccrCast("Prayer of Healing", vPlayerToHeal)
							return
						else
					if vPlayerHealth <= 60
						and not ccrPlayerIsMoving()
						and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
						then
							ccrCast("Greater Heal", vPlayerToHeal)
						return
					else	
						if vPlayerHealth <= 50
							and not ccrPlayerIsMoving()
							then
								ccrCast("Greater Heal", vPlayerToHeal)
							return
							end	
						end		
					end	
				end
			end
			-- Lightwell
			if vPlayerHealth <= 90
				and SpellIsReady("Lightwell")
				and ccrPlayerIsInCombat()
					then
						ccrCast("Lightwell")
						CastAtLocation(Player:GetLocation())
					return
			end	
			-- Renew on tanks at 100%
			if UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
				and not ccrUnitHasBuff(vPlayerToHeal, "Renew")
					then
						ccrCast("Renew", vPlayerToHeal)
					return
			end
		end	
				if vPlayerHealth <= 30
		and not ccrPlayerIsMoving()
		then
		    ccrCast("Flash Heal", vPlayerToHeal)
			return
		end
		--------------------------------- Chakra: Serenity
		if ccrPlayerHasBuff("Chakra: Serenity") then
			-- Renew on tanks at 100%
			if UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
				and not ccrUnitHasBuff(vPlayerToHeal, "Renew")
					then
						ccrCast("Renew", vPlayerToHeal)
					return
			end
			if ccrUnitHasBuff(vPlayerToHeal, "Renew")
				and SpellIsReady("Holy Word: Chastise")
					then
						ccrCast("Holy Word: Chastise", vPlayerToHeal)
					return
			end	
			-- Lightwell
			if vPlayerHealth <= 100
				and ccrPlayerIsInCombat()
				and SpellIsReady("Lightwell")
					then
						ccrCast("Lightwell")
						CastAtLocation(Player:GetLocation())
					return
			end	
			-- Prayer of Mending
			if GroupedPlayersHealth(vPlayerToHeal, 20, 95) >= 2
				and ccrPlayerHasBuff("Divine Insight")
				and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
				and SpellIsReady("Prayer of Mending")
					then
						ccrCast("Prayer of Mending", vPlayerToHeal)
					return
			end
			-- Flash Heal with Serendipity
			if vPlayerHealth <= 95
					and ccrPlayerHasBuff("Surge of Light")
						then
							ccrCast("Flash Heal", vPlayerToHeal)
						return
			end
						-- Prayer of Mending
			if GroupedPlayersHealth(vPlayerToHeal, 20, 95) >= 3
				and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
				and SpellIsReady("Prayer of Mending")
					then
						ccrCast("Prayer of Mending", vPlayerToHeal)
					return
			end
			-- Circle of Healing
			if vPlayerHealth <= 98
				and SpellIsReady("Circle of Healing")
				then
					ccrCast("Circle of Healing", vPlayerToHeal)
				return
			end
				-- Serendipity 
		if ccrPlayerHasBuff("Serendipity") then
			if not ccrPlayerIsMoving() 
						and GroupedPlayersHealth(vPlayerToHeal, 20, 85) >= 5
							then
								ccrCast("Prayer of Healing", vPlayerToHeal)
							return
			
			else
				if not ccrPlayerIsMoving() 
						and GroupedPlayersHealth(vPlayerToHeal, 20, 70) >= 3
							then
								ccrCast("Prayer of Healing", vPlayerToHeal)
							return
					else
				if vPlayerHealth <= 70
					and not ccrPlayerIsMoving()
					then
						ccrCast("Greater Heal", vPlayerToHeal)
					return
				else	
						if vPlayerHealth <= 70
					and not ccrPlayerIsMoving()
					then
						ccrCast("Greater Heal", vPlayerToHeal)
					return
						end	
					end		
				end	
			end
		end
			-- Prayer of Healing with Devout faith
			if ccrPlayerHasBuff("Devout Faith") then
				if vPlayerHealth <= 75
				and not ccrPlayerIsMoving()
				and GroupedPlayersHealth(vPlayerToHeal, 20, 75) >= 3
					then
						ccrCast("Prayer of Healing", vPlayerToHeal)
					return
				else
				if vPlayerHealth <= 50
					and not ccrPlayerIsMoving()
						then
							ccrCast("Greater Heal", vPlayerToHeal)
						return
					end	
				end
			end
			-- Renew on raid
			if vPlayerHealth <= 92
				and not ccrUnitHasBuff(vPlayerToHeal, "Renew")
				then
					ccrCast("Renew", vPlayerToHeal)
				return
			end
		end
    end
end